<template>
  <div class="app-container">

    <div>

      <table>
        <thead>
        <tr>
          <th></th>
          <th>星期一</th>
          <th>星期二</th>
          <th>星期三</th>
          <th>星期四</th>
          <th>星期五</th>
          <th>星期六</th>
          <th>星期日</th>
        </tr>
        </thead>
        <tbody>
        <tr>
          <td colspan="8" style="text-align: center">
            <hr/>
            Korsou
          </td>
        </tr>
        <tr>
          <td>起<br/>止<br/>停<br/>卖</td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime0K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"/>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime0K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime0K}"/>
              <br/>
              <el-checkbox v-model="cb0K"/>
            </div>
          </td>

          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime1K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"/>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime1K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime1K}"/>
              <br/>
              <el-checkbox v-model="cb1K"/>
            </div>
          </td>


          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime2K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"/>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime2K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime2K}"/>
              <br/>
              <el-checkbox v-model="cb2K"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime3K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime3K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime3K}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb3K"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime4K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime4K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime4K}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb4K"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime5K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime5K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime5K}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb5K"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime6K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime6K"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime6K}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb6K"/>
            </div>
          </td>
        </tr>
        <tr>

          <td colspan="8" style="text-align: center">
            <hr/>
            Flamingo
          </td>
        </tr>
        <tr>
          <td>起<br/>止<br/>停<br/>卖</td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime0F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime0F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime0F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb0F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime1F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime1F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime1F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb1F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime2F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime2F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime2F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb2F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime3F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime3F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime3F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb3F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime4F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime4F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime4F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb4F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime5F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime5F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime5F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb5F"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime6F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime6F"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime6F}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb6F"/>
            </div>
          </td>
        </tr>
        <tr>
          <td colspan="8" style="text-align: center">
            <hr/>
            Diario
          </td>
        </tr>
        <tr>
          <td>起<br/>止<br/>停<br/>卖</td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime0D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime0D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime0D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb0D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime1D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime1D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime1D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb1D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime2D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime2D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime2D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb2D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime3D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime3D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime3D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb3D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime4D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime4D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime4D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb4D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime5D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime5D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime5D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb5D"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime6D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime6D"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime6D}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb6D"/>
            </div>
          </td>
        </tr>
        <tr>
          <td colspan="8" style="text-align: center">
            <hr/>
            ST
          </td>
        </tr>
        <tr>
          <td>起<br/>止<br/>停<br/>卖</td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime0S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime0S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime0S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb0S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime1S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime1S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime1S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb1S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime2S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime2S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime2S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb2S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime3S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime3S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime3S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb3S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime4S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime4S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime4S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb4S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime5S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime5S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime5S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb5S"/>
            </div>
          </td>
          <td>
            <div>
              <el-time-select class="time-select"
                              placeholder="起始时间"
                              v-model="startTime6S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime}"></el-time-select>
              <br/>
              <el-time-select class="time-select"
                              placeholder="结束时间"
                              v-model="endTime6S"
                              :picker-options="{
              start:defaultStartTime,
              step: stepTime,
              end: defaultEndTime,
              minTime: startTime6S}"></el-time-select>
              <br/>
              <el-checkbox v-model="cb6S"/>
            </div>
          </td>
        </tr>
        </tbody>
      </table>
    </div>

    <div align="center"><br/>
      <el-button type="primary" @click="updateRegions">保存<i class="el-icon-check el-icon--right"/></el-button>
      <el-button type="primary" @click="getRegions">刷新<i class="el-icon-refresh el-icon--right"/></el-button>
    </div>


  </div>
</template>

<script>
  import axios from "axios";
  import G from "@/components/G";

  export default {
    data() {
      return {
        defaultStartTime: '00:00',
        defaultEndTime: '23:50',
        stepTime: '00:05:00',
        startTime0K: '',
        endTime0K: '',
        cb0K: false,
        startTime1K: '',
        endTime1K: '',
        cb1K: false,
        startTime2K: '',
        endTime2K: '',
        cb2K: false,
        startTime3K: '',
        endTime3K: '',
        cb3K: false,
        startTime4K: '',
        endTime4K: '',
        cb4K: false,
        startTime5K: '',
        endTime5K: '',
        cb5K: false,
        startTime6K: '',
        endTime6K: '',
        cb6K: false,
        startTime0F: '',
        endTime0F: '',
        cb0F: false,
        startTime1F: '',
        endTime1F: '',
        cb1F: false,
        startTime2F: '',
        endTime2F: '',
        cb2F: false,
        startTime3F: '',
        endTime3F: '',
        cb3F: false,
        startTime4F: '',
        endTime4F: '',
        cb4F: false,
        startTime5F: '',
        endTime5F: '',
        cb5F: false,
        startTime6F: '',
        endTime6F: '',
        cb6F: false,
        startTime0D: '',
        endTime0D: '',
        cb0D: false,
        startTime1D: '',
        endTime1D: '',
        cb1D: false,
        startTime2D: '',
        endTime2D: '',
        cb2D: false,
        startTime3D: '',
        endTime3D: '',
        cb3D: false,
        startTime4D: '',
        endTime4D: '',
        cb4D: false,
        startTime5D: '',
        endTime5D: '',
        cb5D: false,
        startTime6D: '',
        endTime6D: '',
        cb6D: false,
        startTime0S: '',
        endTime0S: '',
        cb0S: false,
        startTime1S: '',
        endTime1S: '',
        cb1S: false,
        startTime2S: '',
        endTime2S: '',
        cb2S: false,
        startTime3S: '',
        endTime3S: '',
        cb3S: false,
        startTime4S: '',
        endTime4S: '',
        cb4S: false,
        startTime5S: '',
        endTime5S: '',
        cb5S: false,
        startTime6S: '',
        endTime6S: '',
        cb6S: false,

        //更新数据的实体
        data: null,
      };
    },
    methods: {
      getRegions() {
        const loading = this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });

        axios.post(G.host + 'getRegions').then(res => {
          this.data = res.data
          for (let i = 0; i < res.data.length; i++) {
            if (res.data[i].region_key === "K") {
              this.startTime0K = res.data[i].start0.substring(0, 5);
              this.endTime0K = res.data[i].end0.substring(0, 5)
              this.cb0K = res.data[i].disable0 === 0;
              this.startTime1K = res.data[i].start1.substring(0, 5)
              this.endTime1K = res.data[i].end1.substring(0, 5)
              this.cb1K = res.data[i].disable1 === 0;
              this.startTime2K = res.data[i].start2.substring(0, 5)
              this.endTime2K = res.data[i].end2.substring(0, 5)
              this.cb2K = res.data[i].disable2 === 0;
              this.startTime3K = res.data[i].start3.substring(0, 5)
              this.endTime3K = res.data[i].end3.substring(0, 5)
              this.cb3K = res.data[i].disable3 === 0;
              this.startTime4K = res.data[i].start4.substring(0, 5)
              this.endTime4K = res.data[i].end4.substring(0, 5)
              this.cb4K = res.data[i].disable4 === 0;
              this.startTime5K = res.data[i].start5.substring(0, 5)
              this.endTime5K = res.data[i].end5.substring(0, 5)
              this.cb5K = res.data[i].disable5 === 0;
              this.startTime6K = res.data[i].start6.substring(0, 5)
              this.endTime6K = res.data[i].end6.substring(0, 5)
              this.cb6K = res.data[i].disable6 === 0;
            } else if (res.data[i].region_key === 'F') {
              this.startTime0F = res.data[i].start0.substring(0, 5)
              this.endTime0F = res.data[i].end0.substring(0, 5)
              this.cb0F = res.data[i].disable0 === 0;
              this.startTime1F = res.data[i].start1.substring(0, 5)
              this.endTime1F = res.data[i].end1.substring(0, 5)
              this.cb1F = res.data[i].disable1 === 0;
              this.startTime2F = res.data[i].start2.substring(0, 5)
              this.endTime2F = res.data[i].end2.substring(0, 5)
              this.cb2F = res.data[i].disable2 === 0;
              this.startTime3F = res.data[i].start3.substring(0, 5)
              this.endTime3F = res.data[i].end3.substring(0, 5)
              this.cb3F = res.data[i].disable3 === 0;
              this.startTime4F = res.data[i].start4.substring(0, 5)
              this.endTime4F = res.data[i].end4.substring(0, 5)
              this.cb4F = res.data[i].disable4 === 0;
              this.startTime5F = res.data[i].start5.substring(0, 5)
              this.endTime5F = res.data[i].end5.substring(0, 5)
              this.cb5F = res.data[i].disable5 === 0;
              this.startTime6F = res.data[i].start6.substring(0, 5)
              this.endTime6F = res.data[i].end6.substring(0, 5)
              this.cb6F = res.data[i].disable6 === 0;
            } else if (res.data[i].region_key === 'D') {
              this.startTime0D = res.data[i].start0.substring(0, 5)
              this.endTime0D = res.data[i].end0.substring(0, 5)
              this.cb0D = res.data[i].disable0 === 0;
              this.startTime1D = res.data[i].start1.substring(0, 5)
              this.endTime1D = res.data[i].end1.substring(0, 5)
              this.cb1D = res.data[i].disable1 === 0;
              this.startTime2D = res.data[i].start2.substring(0, 5)
              this.endTime2D = res.data[i].end2.substring(0, 5)
              this.cb2D = res.data[i].disable2 === 0;
              this.startTime3D = res.data[i].start3.substring(0, 5)
              this.endTime3D = res.data[i].end3.substring(0, 5)
              this.cb3D = res.data[i].disable3 === 0;
              this.startTime4D = res.data[i].start4.substring(0, 5)
              this.endTime4D = res.data[i].end4.substring(0, 5)
              this.cb4D = res.data[i].disable4 === 0;
              this.startTime5D = res.data[i].start5.substring(0, 5)
              this.endTime5D = res.data[i].end5.substring(0, 5)
              this.cb5D = res.data[i].disable5 === 0;
              this.startTime6D = res.data[i].start6.substring(0, 5)
              this.endTime6D = res.data[i].end6.substring(0, 5)
              this.cb6D = res.data[i].disable6 === 0;
            } else if (res.data[i].region_key === 'S') {
              this.startTime0S = res.data[i].start0.substring(0, 5)
              this.endTime0S = res.data[i].end0.substring(0, 5)
              this.cb0S = res.data[i].disable0 === 0;
              this.startTime1S = res.data[i].start1.substring(0, 5)
              this.endTime1S = res.data[i].end1.substring(0, 5)
              this.cb1S = res.data[i].disable1 === 0;
              this.startTime2S = res.data[i].start2.substring(0, 5)
              this.endTime2S = res.data[i].end2.substring(0, 5)
              this.cb2S = res.data[i].disable2 === 0;
              this.startTime3S = res.data[i].start3.substring(0, 5)
              this.endTime3S = res.data[i].end3.substring(0, 5)
              this.cb3S = res.data[i].disable3 === 0;
              this.startTime4S = res.data[i].start4.substring(0, 5)
              this.endTime4S = res.data[i].end4.substring(0, 5)
              this.cb4S = res.data[i].disable4 === 0;
              this.startTime5S = res.data[i].start5.substring(0, 5)
              this.endTime5S = res.data[i].end5.substring(0, 5)
              this.cb5S = res.data[i].disable5 === 0;
              this.startTime6S = res.data[i].start6.substring(0, 5)
              this.endTime6S = res.data[i].end6.substring(0, 5)
              this.cb6S = res.data[i].disable6 === 0;
            }
          }
          this.$notify({
            title: '获取数据',
            message: this.$createElement('i', {style: 'color: teal'}, '成功！'),
            duration: 2000
          });
          loading.close()
        });
      },
      updateRegions() {
        let data = this.data
        for (let i = 0; i < data.length; i++) {
          if (data[i].region_key === 'K') {
            data[i].start0 = this.startTime0K + ':00'
            data[i].end0 = this.endTime0K + ':00'
            data[i].disable0 = this.cb0K ? 0 : -1
            data[i].start1 = this.startTime1K + ':00'
            data[i].end1 = this.endTime1K + ':00'
            data[i].disable1 = this.cb1K ? 0 : -1
            data[i].start2 = this.startTime2K + ':00'
            data[i].end2 = this.endTime2K + ':00'
            data[i].disable2 = this.cb2K ? 0 : -1
            data[i].start3 = this.startTime3K + ':00'
            data[i].end3 = this.endTime3K + ':00'
            data[i].disable3 = this.cb3K ? 0 : -1
            data[i].start4 = this.startTime4K + ':00'
            data[i].end4 = this.endTime4K + ':00'
            data[i].disable4 = this.cb4K ? 0 : -1
            data[i].start5 = this.startTime5K + ':00'
            data[i].end5 = this.endTime5K + ':00'
            data[i].disable5 = this.cb5K ? 0 : -1
            data[i].start6 = this.startTime6K + ':00'
            data[i].end6 = this.endTime6K + ':00'
            data[i].disable6 = this.cb6K ? 0 : -1
          } else if (data[i].region_key === 'F') {
            data[i].start0 = this.startTime0F + ':00'
            data[i].end0 = this.endTime0F + ':00'
            data[i].disable0 = this.cb0F ? 0 : -1
            data[i].start1 = this.startTime1F + ':00'
            data[i].end1 = this.endTime1F + ':00'
            data[i].disable1 = this.cb1F ? 0 : -1
            data[i].start2 = this.startTime2F + ':00'
            data[i].end2 = this.endTime2F + ':00'
            data[i].disable2 = this.cb2F ? 0 : -1
            data[i].start3 = this.startTime3F + ':00'
            data[i].end3 = this.endTime3F + ':00'
            data[i].disable3 = this.cb3F ? 0 : -1
            data[i].start4 = this.startTime4F + ':00'
            data[i].end4 = this.endTime4F + ':00'
            data[i].disable4 = this.cb4F ? 0 : -1
            data[i].start5 = this.startTime5F + ':00'
            data[i].end5 = this.endTime5F + ':00'
            data[i].disable5 = this.cb5F ? 0 : -1
            data[i].start6 = this.startTime6F + ':00'
            data[i].end6 = this.endTime6F + ':00'
            data[i].disable6 = this.cb6F ? 0 : -1
          } else if (data[i].region_key === 'D') {
            data[i].start0 = this.startTime0D + ':00'
            data[i].end0 = this.endTime0D + ':00'
            data[i].disable0 = this.cb0D ? 0 : -1
            data[i].start1 = this.startTime1D + ':00'
            data[i].end1 = this.endTime1D + ':00'
            data[i].disable1 = this.cb1D ? 0 : -1
            data[i].start2 = this.startTime2D + ':00'
            data[i].end2 = this.endTime2D + ':00'
            data[i].disable2 = this.cb2D ? 0 : -1
            data[i].start3 = this.startTime3D + ':00'
            data[i].end3 = this.endTime3D + ':00'
            data[i].disable3 = this.cb3D ? 0 : -1
            data[i].start4 = this.startTime4D + ':00'
            data[i].end4 = this.endTime4D + ':00'
            data[i].disable4 = this.cb4D ? 0 : -1
            data[i].start5 = this.startTime5D + ':00'
            data[i].end5 = this.endTime5D + ':00'
            data[i].disable5 = this.cb5D ? 0 : -1
            data[i].start6 = this.startTime6D + ':00'
            data[i].end6 = this.endTime6D + ':00'
            data[i].disable6 = this.cb6D ? 0 : -1
          } else if (data[i].region_key === 'S') {
            data[i].start0 = this.startTime0S + ':00'
            data[i].end0 = this.endTime0S + ':00'
            data[i].disable0 = this.cb0S ? 0 : -1
            data[i].start1 = this.startTime1S + ':00'
            data[i].end1 = this.endTime1S + ':00'
            data[i].disable1 = this.cb1S ? 0 : -1
            data[i].start2 = this.startTime2S + ':00'
            data[i].end2 = this.endTime2S + ':00'
            data[i].disable2 = this.cb2S ? 0 : -1
            data[i].start3 = this.startTime3S + ':00'
            data[i].end3 = this.endTime3S + ':00'
            data[i].disable3 = this.cb3S ? 0 : -1
            data[i].start4 = this.startTime4S + ':00'
            data[i].end4 = this.endTime4S + ':00'
            data[i].disable4 = this.cb4S ? 0 : -1
            data[i].start5 = this.startTime5S + ':00'
            data[i].end5 = this.endTime5S + ':00'
            data[i].disable5 = this.cb5S ? 0 : -1
            data[i].start6 = this.startTime6S + ':00'
            data[i].end6 = this.endTime6S + ':00'
            data[i].disable6 = this.cb6S ? 0 : -1
          }
        }
        //传参json
        axios.post(G.host + 'updateRegion', JSON.stringify(data), {
          headers: {
            "Content-Type": "application/json;charset=utf-8"
          }
        }).then(res => {
          this.$notify({
            title: '保存',
            message: this.$createElement('i', {style: 'color: teal'}, '成功！'),
            duration: 2000
          });
        })
      }
    },
    mounted() {
      this.getRegions()
    }
  }
</script>

<style scoped>
  .time-select {
    width: 140px;
  }
</style>
